package com.mofofa.maozy.loan

import android.annotation.SuppressLint
import android.view.View
import androidx.lifecycle.ViewModel
import androidx.navigation.findNavController
import com.mofofa.maozy.R
import com.mofofa.maozy.base.BaseActivity
import com.mofofa.maozy.databinding.ActivityMaozyLoanReviewBinding
import com.mofofa.maozy.enums.PageTagEnum
import com.mofofa.maozy.me.MeLoanReviewFragmentDirections
import com.mofofa.maozy.statement.StatementLoanReviewFragmentDirections

/** 审核中 */
@SuppressLint("CustomSplashScreen")
class LoanReviewActivity : BaseActivity() {

    private lateinit var mMaozyActivityMaozyBinding: ActivityMaozyLoanReviewBinding

    override fun onMaozyBindingMaozyViewMaozyModel(): List<ViewModel>? {
        val list = mutableListOf<ViewModel>()
        return list
    }

    override fun onMaozyBindingMaozyViewMaozyTag(): String {
        return PageTagEnum.review.name.uppercase()
    }

    override fun onMaozyBindingMaozyContentMaozyView(): View {
        mMaozyActivityMaozyBinding = ActivityMaozyLoanReviewBinding.inflate(layoutInflater)
        return mMaozyActivityMaozyBinding.root
    }

    override fun onMaozyContentMaozyViewMaozyBinded() {
        try {
            mMaozyActivityMaozyBinding.bottomTabBarLoanReview.setMaozyOnMaozyActionMaozyClickMaozyListener {
                when (it) {
                    0 -> {
                        if (findNavController(R.id.navLoanReviewFragment).currentDestination?.id == R.id.loan_review_me) {
                            findNavController(R.id.navLoanReviewFragment)
                                .navigate(MeLoanReviewFragmentDirections.toLoanReviewHome())

                        } else if (findNavController(R.id.navLoanReviewFragment).currentDestination?.id == R.id.loan_review_statement) {
                            findNavController(R.id.navLoanReviewFragment)
                                .navigate(StatementLoanReviewFragmentDirections.toLoanReviewHome())
                        }
                    }
                    1 -> {
                        if (findNavController(R.id.navLoanReviewFragment).currentDestination?.id == R.id.loan_review_home) {
                            findNavController(R.id.navLoanReviewFragment)
                                .navigate(LoanReviewFragmentDirections.toLoanReviewStatement())

                        } else if (findNavController(R.id.navLoanReviewFragment).currentDestination?.id == R.id.loan_review_me) {
                            findNavController(R.id.navLoanReviewFragment)
                                .navigate(MeLoanReviewFragmentDirections.toLoanReviewStatement())
                        }
                    }
                    2 -> {
                        if (findNavController(R.id.navLoanReviewFragment).currentDestination?.id == R.id.loan_review_home) {
                            findNavController(R.id.navLoanReviewFragment)
                                .navigate(LoanReviewFragmentDirections.toLoanReviewMe())

                        } else if (findNavController(R.id.navLoanReviewFragment).currentDestination?.id == R.id.loan_review_statement) {
                            findNavController(R.id.navLoanReviewFragment)
                                .navigate(StatementLoanReviewFragmentDirections.toLoanReviewMe())
                        }
                    }
                    else -> {

                    }
                }
            }
        } catch (e: Exception) {
            e.printStackTrace()
        }
    }

}